package com.deduction.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.base.common.persistence.Page;
import com.base.common.service.CrudService;
import com.deduction.dao.ProjectDeviceMapper;
import com.deduction.model.ProjectDevice;
import com.deduction.service.ProjectDeviceService;
@Service
public class ProjectDeviceServiceImpl extends CrudService<ProjectDeviceMapper, ProjectDevice> implements
		ProjectDeviceService {
	
	public Page findProjectDevicePageByProjectId(String projectId, Page page)
			throws Exception {

		Map<String, String> params = new HashMap<String, String>();
		params.put("projectId", projectId);
		String sql = "SELECT a.*, d.device_name  FROM company_device d , project_device a WHERE d.id = a.device_id and a.project_id = #{projectId} ";
		page = this.getPage(page, sql, ProjectDevice.class, params);
		return page;
	}
}
